package org.broadway.monitor.dsl;

/**
 * This is a utility class that provides syntactic shortcuts
 * that implies how Conditionals should be built and used.
 * @author vladimir vivien
 * @see Conditional
 */
public class When {
	/**
	 * Method that instantiate a BinaryCondition and expects
	 * action to be taken when the condition evaluates to True.
	 * @param exp - A string expression which will be evaluated.
	 * @return BinaryCondition created.
	 */
	public static BinaryCondition thisIsTrue(String exp){
		BinaryCondition condition = new BinaryCondition(exp);
		condition.setExecWhen(true);
		return condition;
	}
	
	/**
	 * Method that instantiates a BinaryCondition that is expected
	 * to take action when the provided condition evalutes to False.
	 * @param exp - A textual expression which will be evaluated.
	 * @return BinarayCondition created.
	 */
	public static BinaryCondition thisIsFalse(String exp){
		BinaryCondition condition = new BinaryCondition(exp);
		condition.setExecWhen(false);
		return condition;
	}
	
}
